<?php
use yii\helpers\Html;
use app\modules\admin\assets\AppAsset;
use yii\helpers\Url;
use app\modules\admin\widgets\MenuLeft;

AppAsset::register($this);
$js = <<<JS
$(document).ready(function () {
    $('.sidebar-menu').tree()
});
$('.rfTopMenu').click(function() {
    var type = $(this).data('type');
    if (type) {
        $('.rfTopMenu').removeClass('rfTopMenuHover');
        $('.aleftMenu').addClass('hide');
        $('.aleftMenu-' + type).removeClass('hide');
        $(this).addClass('rfTopMenuHover');
    }
});
JS;
$this->registerJs($js, \yii\web\View::POS_END);
$this->registerCss("
    .rfTopMenuHover {
        background-color: rgba(0,0,0,.1);
        color: #f6f6f6;
    }
");
$this->title = '系统管理';
?>
<?php $this->beginPage() ?>
<!doctype html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
</head>
<body class="skin-blue sidebar-mini fixed sidebar-mini-expand-feature">
<?php $this->beginBody() ?>
<div class="wrapper">
    <header class="main-header">
        <a class="logo" href="<?= Url::toRoute(['/admin']) ?>">
            <span class="logo-mini"><b>Y</b>II2</span>
            <span class="logo-lg"><b>Yii2</b> Admin</span>
        </a>
        <nav class="navbar navbar-static-top">
            <!-- Sidebar toggle button-->
            <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>
            <div class="navbar-custom-menu navbar-left">
                <ul class="nav navbar-nav">
                    <?php foreach($model as $cate): ?>
                    <li class="dropdown notifications-menu rfTopMenu  <?= $cate['id'] == 1 ? 'rfTopMenuHover' : '' ?>" data-type="<?= $cate['id'] ?>">
                        <a class="dropdown-toggle">
                            <i class="fa fa-<?= $cate['icon'] ?>"></i> <?= $cate['name'] ?>
                        </a>
                    </li>
                    <?php endforeach; ?>
                </ul>
            </div>
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <li class="dropdown user user-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="/adminL/dist/img/user2-160x160.jpg" class="user-image" alt="User Image">
                            <span class="hidden-xs"><?= Yii::$app->admin->identity->username ?></span>
                        </a>
                        <ul class="dropdown-menu">
                            <!-- User image -->
                            <li class="user-header">
                                <img src="/adminL/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">

                                <p>
                                    <?= Yii::$app->admin->identity->username ?>
                                    <small>Member since Nov. 2012</small>
                                </p>
                            </li>
                            <!-- Menu Body -->
                            <li class="user-body">
                                <div class="row">
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Followers</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Sales</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Friends</a>
                                    </div>
                                </div>
                                <!-- /.row -->
                            </li>
                        </ul>
                    </li>
                    <!-- Control Sidebar Toggle Button -->
                    <li>
                        <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
                    </li>
                </ul>
            </div>
        </nav>
    </header>

    <aside class="main-sidebar">
        <section class="sidebar">
            <!-- Sidebar user panel -->
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="/adminL/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
                </div>
                <div class="pull-left info">
                    <p><?= Yii::$app->admin->identity->username ?></p>
                    <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
                </div>
            </div>
            <!-- sidebar menu: : style can be found in sidebar.less -->
            <ul class="sidebar-menu" data-widget="tree">
                <li class="header" data-rel="external">系统菜单</li>
                <?= MenuLeft::widget(); ?>
            </ul>
        </section>
    </aside>

    <div class="content-wrapper">
        <div class="content-tabs">
            <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-angle-double-left"></i></button>
            <nav class="page-tabs J_menuTabs" id="rftags">
                <div class="page-tabs-content">
                    <a href="javascript:void (0);" class="active J_menuTab" data-id="<?= Url::to(['default/main']); ?>" id="rftagsIndexLink">首页</a>
                    <!--默认主页需在对应的选项卡a元素上添加data-id="默认主页的url"-->
                </div>
            </nav>
            <button class="roll-nav roll-right J_tabRight"><i class="fa fa-angle-double-right"></i></button>
            <div class="btn-group roll-nav roll-right">
                <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作</button>
                <ul role="menu" class="dropdown-menu dropdown-menu-right">
                    <li class="J_tabShowActive"><a>定位当前选项卡</a></li>
                    <li class="divider"></li>
                    <li class="J_tabCloseAll"><a>关闭全部选项卡</a></li>
                    <li class="J_tabCloseOther"><a>关闭其他选项卡</a></li>
                </ul>
            </div>
            <?= Html::a('<i class="fa fa fa-sign-out"></i> 退出', ['auth/logout'], [
                'class' => 'roll-nav roll-right J_tabExit',
                'data-method' => 'post',
                'data-confirm' => '你确定要退出吗？'
            ]) ?>
        </div>
        <div class="J_mainContent" id="content-main">
            <!--默认主页需在对应的页面显示iframe元素上添加name="iframe0"和data-id="默认主页的url"-->
            <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="<?= Url::to(['default/main']); ?>" frameborder="0" data-id="<?= Url::to(['default/main']); ?>" seamless></iframe>
        </div>
    </div>
    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
        <div class="tab-content">
            <!-- Home tab content -->
            <div class="tab-pane" id="control-sidebar-home-tab"></div>
        </div>
    </aside>
    <!-- 右侧区域 -->
    <div class="control-sidebar-bg"></div>
</div>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>